home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Database How-To / Visual Basic 4 Database - How-to (The Waite Group)(1995).iso / secured.cl_ / secured.cl
Text File  |  1995-07-20  |  2KB  |  81 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = 0   'False
  4. END
  5. Attribute VB_Name = "SecuredDatabase"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. 'Private data access objects
  11. Private db As DATABASE
  12. Private rs As Recordset
  13.  
  14. Private dbFileName As String
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. Public Property Get BOF() As Boolean
  23.     BOF = rs.BOF
  24. End Property
  25.  
  26. Public Property Get EOF() As Boolean
  27.     EOF = rs.EOF
  28. End Property
  29.  
  30. Property Get FieldCount() As Long
  31.     FieldCount = rs.Fields.Count
  32. End Property
  33.  
  34. Property Get RecordCount() As Long
  35.     Dim bm As String
  36.     
  37.     'Save our location in the recordset
  38.     bm = rs.Bookmark
  39.     rs.MoveLast
  40.     RecordCount = rs.RecordCount
  41.     
  42.     'Return to the starting position in the recordset
  43.     rs.Bookmark = bm
  44. End Property
  45. Public Function GetField(fieldNum As Integer) As Variant
  46.     GetField = rs.Fields(fieldNum).VALUE
  47. End Function
  48. Public Sub MoveFirst()
  49.     'Move to the first record in the recordset
  50.     rs.MoveFirst
  51. End Sub
  52.  
  53. Public Sub MoveLast()
  54.     'Move to the last record
  55.     rs.MoveLast
  56. End Sub
  57.  
  58. Public Sub MoveNext()
  59.     'Move to the next record
  60.     rs.MoveNext
  61. End Sub
  62.  
  63. Public Sub MovePrevious()
  64.     'Move to the previous record
  65.     rs.MovePrevious
  66. End Sub
  67.  
  68. Private Sub Class_Initialize()
  69.     'Include any database security access parameters here
  70.     dbFileName = App.Path & "\biblio.mdb"
  71.     Set db = OpenDatabase(dbFileName)
  72.     Set rs = db.OpenRecordset("Authors")
  73. End Sub
  74.  
  75. Private Sub Class_Terminate()
  76.     Set db = Nothing
  77.     Set rs = Nothing
  78. End Sub
  79.  
  80.  
  81.